<template>
	<view class="main_container">
		<scroll-view class="member_lsit" scroll-y="true" :style="'height:100%'" enable-flex
			@scrolltolower="scrollToLower()" @scrolltoupper="updateOrderInfo()">
			<view v-show="item.title" class="video_item" v-for="(item,index) in memberList" :key="index"
				@click="rencaiDetail(memberList[index])">
				<!-- <image class="video_img" :src="item.image"></image> -->
				<view class="video_content">
					<view style="width: 100%;">
						<text class="video_title">{{item.title}}</text>
						<view style="float:right;margin-top: 12rpx;;margin-right: 10rpx;">
							<uni-tag type="success" v-if="item.isJiebang == 0" inverted="true" text="未挂帅"></uni-tag>
							<uni-tag type="error" v-else text="已挂帅"></uni-tag>
						</view>
					</view>
					<view style="width: 100%; margin-top: 18rpx; font-size: 28rpx;float: left;">
						<text style="">单位名称：{{item.enterpriseName}}</text>
					</view>
					<view style="width: 100%; margin-top: 18rpx; font-size: 25rpx;float: left;color: gray;">
						<text style="">发布时间：{{item.createTime}}</text>
					</view>

				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	import env from '@/utils/env.js'
	import * as jbgs from "@/api/jbgs/index.js";
	import * as dict from '@/api/system/dict/data.js'
	import uniTag from "@/components/uni-tag/components/uni-tag/uni-tag.vue"

	import {
		codeList
	} from "@/utils/code";
	import {
		defineComponent
	} from "vue";
	export default {
		components: {
			uniTag
		},
		data() {
			return {
				title: '',
				memberList: [{
					researchDirection: ''
				}],
				currentType: 0,
				researchDirection: [

				],
				query: {
					pageSize: 10,
					pageNum: 1
				},
				total: 0,
				noData: '加载中',

			}
		},
		onLoad(option) {
			this.listTechperson()
			uni.showLoading({})
			this.getDict()
		},
		methods: {
			getDict() {
				dict.getDicts("person_talent_type").then((res) => {
					if (res.data && res.data.length > 0) {
						this.researchDirection = res.data
						console.log(this.researchDirection)
					}
				})
			},
			listTechperson() {
				jbgs.getJbgsbd(this.query).then((res) => {
					res.rows.forEach(v => {
						// v.warehousTime =  v.warehousTime.substr(0, 10)
						this.memberList.push(v)
					})
					uni.hideLoading({})
					console.log(this.memberList)
					this.total = res.total
				})
			},
			rencaiDetail(item) {
				uni.navigateTo({
					url: '/subpages/pages/jbgs/detail?id=' + item.id
				})
			},
			getType(type) {
				var persontype = ''
				this.researchDirection.forEach(v => {
					if (v.dictValue == type)
						persontype = v.dictLabel
				})
				return persontype
			},
			// 更新order
			updateOrderInfo(index) {
				let _this = this
				if (_this.currentIndex == 0) {
					this.cgdjquery.pageNum = 1
					this.memberList = []
					_this.listTechperson()
				} else {
					this.cgzhquery.pageNum = 1
					this.memberList = []
					_this.listTechperson()
				}
			},
			// 滑到底部 加载更多
			scrollToLower() {
				console.log('222')
				let _this = this
				if (_this.memberList.length < _this.total) {
					console.log('111')
					_this.query.pageNum = _this.query.pageNum + 1;
					_this.listTechperson();

				} else {
					console.log('333')
					uni.showToast({
						icon: 'none',
						title: "没有更多数据"
					})
				}
			},
		}
	}
</script>

<style>
	.main_container {
		width: 100vw;
		height: 100vh;
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
		align-items: center;
		background-color: #e3e3e3;
	}

	.member_lsit {
		height: fit-content;
		width: 100%;
		padding-top: 1rpx;
		padding-bottom: 1rpx;
		background-color: #e3e3e3;
	}

	.video_item {
		height: 175rpx;
		width: 95%;
		padding: 20rpx;
		margin: 20rpx auto;
		border-radius: 10rpx;
		background-color: #fff;
		box-shadow: 5rpx 0rpx 10rpx #e3e3e3;
	}

	.video_img {
		margin-top: 25rpx;
		height: 190rpx;
		width: 180rpx;
		border-radius: 50%;
		margin-left: 30rpx;
		float: left;
	}

	.video_content {
		width: 100%;
		height: 140rpx;
		margin-left: 15rpx;
	}

	.video_title {
		display: -webkit-box;
		width: 80%;
		float: left;
		margin-top: 20rpx;
		font-size: 32rpx;
		font-weight: 700;
		overflow: hidden;
		word-break: break-all;
		/* break-all(允许在单词内换行。) */
		text-overflow: ellipsis;
		/* 超出部分省略号 */
		display: -webkit-box;
		/** 对象作为伸缩盒子模型显示 **/
		-webkit-box-orient: vertical;
		/** 设置或检索伸缩盒对象的子元素的排列方式 **/
		-webkit-line-clamp: 1;
		/** 显示的行数 **/
	}

	.publicTime {
		float: right;
		font-size: 23rpx;
		color: darkred;
		margin-top: 15rpx;

	}

	.devideline {
		float: left;
		height: 0.3rpx;
		width: 100%;
		background-color: #eeeeee;
		margin-top: 15rpx;
		margin-bottom: 15rpx;
	}
</style>